<?php

/*

<script type="text/javascript">
	$(document).ready(function() { 
		$('#icon-loading').hide();
		$('input[name="submit_upload"]').click(function(){$('#icon-loading').show();});
	});

</script>
*/
?>

<style type="text/css">
#import input[type="radio"] {vertical-align: top;}
</style>

<?php
    if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
        //This is a server using Windows!
    } else {
        //This is a server not using Windows!
        $upload_path = APPPATH.'../uploads';
        $group = posix_getgrgid(filegroup($upload_path));
		if($group['name'] != 'www-data')
		{
			echo '<div class="alert alert-danger">Achtung die Gruppe für den Upload-Pfad ist nicht "www-data"!</div>';
		}
		if(fileperms ($upload_path) != 16888) // 770
		{
			echo '<div class="alert alert-danger">Achtung die Rechte für den Upload-Ordner sind nicht "770"!</div>';
		}
    }
?>


<?php
// Formular zum Dateiumport


echo form_open_multipart($form['target'], 'id="import"');

foreach($form['radio_buttons'] as $text => $radio_button)
{
	echo '<p>'.form_radio($radio_button).$text.'</p>';
}

echo '<br>';

echo form_upload($form['upload']);
echo form_submit($form['submit']);
echo form_close();



if(isset($errors))
{ 
	echo '<hr><div class="alert alert-danger">';
	foreach($errors as $error)
	{
		echo '<p>'. $error .'</p>'; 
	}
	echo '</div>';
}

if(isset($notifications))
{ 
	echo '<hr><div class="alert alert-success">';
	foreach($notifications as $notification)
	{
		echo '<p>'.$notification.'</p>'; 
	}
	echo '</div>';
}
?>